<?php
// Chargement de la biblioteque
require_once('bph_load.php');

// Creation de la page
$page=new BphHtml('bph_demo');
$page->author = 'Bruno paulin';
$page->title = 'bph_demo';

// Ajout d'un style
$page->AddCss('css/bph.css');

// Formulaires
/*
$form = new BphForm( 'action.php' );

$fs = new BphFieldSet( 'input' ); 
//~ $text = new BphFText('input1', 'texte', '', 'exemple de texte');
//~ $pass = new BphFPassword('input2', 'mot de passe', '', 'exemple de texte');
//~ $email = new BphFEmail('input3', 'e-mail', '@', 'exemple de texte');
//~ $url = new BphFUrl('input4', 'site', '', 'exemple de texte');
//~ $tel = new BphFTel('input5', 'telephone', '06', 'exemple de texte');
//~ $search = new BphFSearch('input6', 'recherche', '?', 'exemple de texte');
$fs->AddItems($text,$pass,$email,$url,$tel,$search);
$form->AddItems( $fs );
$page->AddItems( $form );
*/



// Titres
$titres = new BphArticle();
$titres->AddAttribut('id','titres');
for ($i = 1; $i <= 6 ; $i++){
	$titres->AddItems( new BphH($i, "titre$i") );
}
$page->AddItems($titres);

// Liens
$liens = new BphArticle();
$liens->AddAttribut('id','liens');
$a = new BphA('http://google.fr','lien vers google');
$liens->AddItems( $a, new BphItem('br') );
$a = new BphA('#top','lien vers une ancre');
$liens->AddItems( $a, new BphItem('br') );
$page->AddItems($liens);

// Dump
/*
$page->AddItems(new BphVarDump($_GET,'$_GET'));
$page->AddItems(new BphVarDump($_POST,'$_POST'));
$page->AddItems(new BphVarDump($_COOKIE,'$_COOKIE'));
$page->AddItems(new BphVarDump($page,'$_SESSION'));
*/

// Table
$table = new BphTable();
$table->AddAttribut('border', 1);
$table->caption='description';

$table->head->AddTd('^1');
$table->head->AddTd('^2');
$table->head->AddTd('^3');
for ($i = 0; $i < 10; $i++){
	$tr = $table->AddTr();
	$tr->AddTd($i);	
	$tr->AddTd($i*$i);	
	$tr->AddTd($i*$i*$i);	
}
$tr = $table->AddTr();
$td = $tr->AddTd('test');
$td->colspan = 2;
$table->foot = $table->head;
$page->AddItems($table);

// Image
$img = new BphImg( 'http://www.w3.org/Icons/WWW/w3c_home_nb.png', 'w3c' );
$page->AddItems($img);

// Liste ordonnée
// Liste a puces
$ol = new BphList(TRUE);
$ul = new BphList();
for ($i = 1; $i <= 10; $i++) {
	$ol->AddLi("li n°$i");
	$ul->AddLi("li n°$i");
}
$page->AddItems($ol);
$page->AddItems($ul);






/*
// Creation des onglets
$tdi = new BphTdi();

// Welcome
$onglet= $tdi->AddTab('Bienvenue');
$a= new BphA('http://bpaulin.net', 'bpaulin.net');
$a->AddItems('bpaulin.net');
$onglet->AddItems("Ceci est le démo de Bp-h.
Cet ensemble de script évite d'utiliser de l'html dans les scripts php",
$a,
"a votre service");

// Dumps
$onglet= $tdi->AddTab('onglet 0');
$onglet->AddItems(new BphVarDump($_GET,'$_GET'));
$onglet->AddItems(new BphVarDump($_POST,'$_POST'));
$onglet->AddItems(new BphVarDump($_COOKIE,'$_COOKIE'));
$onglet->AddItems(new BphVarDump($_SESSION,'$_SESSION'));

// Titres
$onglet= $tdi->AddTab('onglet 1');
for ($i = 1; $i <=6; $i++) {
	$h = new BphH($i,"titre n°$i");
	$onglet->AddItems($h);	
}

// Liens
$onglet= $tdi->AddTab('onglet 1');
$a = new BphA('http://bpaulin.net', 'bpaulin.net');
$a->AddItems('lien');
$onglet->AddItems($a);



//Tableau
$onglet= $tdi->AddTab('onglet 3');
$table = new BphTable();
$table->AddAttribut('border', 1);
$table->head->AddTd('^1');
$table->head->AddTd('^2');
$table->head->AddTd('^3');
for ($i = 0; $i < 10; $i++){
	$tr = $table->AddTr();
	$tr->AddTd($i);	
	$tr->AddTd($i*$i);	
	$tr->AddTd($i*$i*$i);	
}
$onglet->AddItems($table);

$page->AddItems($tdi);

$form = new BphForm('#');
$fieldset= new BphFieldSet('fieldset 1');
$text = new BphFieldText('id', 'value', 'label');
$fieldset->AddItems ( $text );
$pass = new BphFieldPass('id', 'value', 'label');
$fieldset->AddItems ( $pass );
$area = new BphFieldArea('id2', 10, 15, 'value2', 'label2');
$fieldset->AddItems ( $area );
$check = new BphFieldCheck('id3', TRUE, 'label3');
$fieldset->AddItems ( $check );


$select = new BphFieldSelect('id4', 'label4');
for ($i = 0; $i < 10; $i++){
	$group = $select->AddGroup("group$i");
	for ($j = 0; $j < 10; $j++){
		$option = new BphFieldOption($i+$j,"value$i $j");
		$group->AddItems($option);
	}
}
$fieldset->AddItems($select);

$submit = new BphFieldSubmit('submit', 'envoyer');
$fieldset->AddItems($submit);

$form->AddItems($fieldset);
$page->AddItems($form);
*/



echo $page->Code();
?>
